<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./grade.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            padding: 20px 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .box img {
            width: 50%;
        }
    </style>
</head>

<body>
    <div class="box"><img src="../../img/01.jpg" alt="" /></div>
    <div class="box"><img src="../../img/02.jpg" alt="" /></div>
    <div class="box"><img src="../../img/05.jpg" alt="" /></div>
</body>
<script>
    // 背景自动渐变
    window.addEventListener('load', function () {
        /*            
            A NodeList of all your image containers (Or a single Node).            
            The library will locate an <img /> within each            
            container to create the gradient from.         
        */
        Grade(document.querySelectorAll('.box'))
    })
</script>

</html>